﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using CDefineGlobal;

namespace CObject
{
    public class AbstractRocket : CObject
    {
        private int i_Speed;
        private int i_Power;
        private int i_Type;
        private int i_ToMove;  //hướng đi mà đạn muốn di chuyển
        private int i_XMove;
        private int i_YMove;

        private bool enabled;

        private Point location;
        private Bitmap bBitmap;

        public Bitmap BBitmap
        {
            get { return bBitmap; }
            set { bBitmap = value; }
        }
        public Point Location
        {
            get { return location; }
            set { location = value; }
        }
        public int I_Type
        {
            get { return i_Type; }
            set { i_Type = value; }
        }
        public int I_Speed
        {
            get { return i_Speed; }
            set { i_Speed = value; }
        }
        public int I_Power
        {
            get { return i_Power; }
            set { i_Power = value; }
        }
        public int I_ToMove
        {
            get { return i_ToMove; }
            set { i_ToMove = value; }
        }
        public int I_XMove
        {
            get { return i_XMove; }
            set { i_XMove = value; }
        }
        public int I_YMove
        {
            get { return i_YMove; }
            set { i_YMove = value; }
        }
        public bool Enabled
        {
            get { return enabled; }
            set { enabled = value; }
        }

        public void ChangeLocation(int x, int y) { this.Location = new Point(x, y); }
        public void MoveToDirection(int iDirection) { this.I_ToMove = iDirection; }
        public void Show(bool bShow) { this.Enabled = bShow; }
        public void Fire(int iDirection, Point location)
        {
            this.Location = location;
            this.I_ToMove = iDirection;
            this.Enabled = true;
        }
        public Rectangle GetRect()
        {
            return new Rectangle(this.Location, this.BBitmap.Size);
        }

        //chuyển từ một picture box chưa được transparent sang một bitmap đã được transparent
        public Bitmap GetBitmapTransparent(Image img)
        {
            Bitmap b = new Bitmap(img);
            b.MakeTransparent(Color.Black);

            return b;
        }//end of func
    }
}
